package com.sk.ccflower.server.lib.dbUtils.sql;

import java.util.ArrayList;

import com.sk.ccflower.lib.define.DBTable;
import com.sk.ccflower.lib.mtBeans.MatchingProfileBean;
import com.sk.ccflower.server.lib.dbBeans.MfMatchBean;
import com.sk.ccflower.server.lib.dbUtils.SQLReturn;

public class MfMatchSql extends BaseSql {
	
private static final String m_column = "src_user, dest_user, score, confirm";
	
	private static final String m_basequery = "SELECT m.dest_user as email, p.alias, p.sex, p.birth_year, p.birth_day, p.addr, p.nation, p.language, m.score, m.m_date FROM " + DBTable.CF_PROFILE + " p, " + DBTable.MF_MATCH + " m WHERE p.email = m.dest_user";
	private static String m_insertQuery = null;
	
	static {
		m_insertQuery = makeInsertSql(DBTable.MF_MATCH, m_column);
	}
	
	public MfMatchSql() throws Exception {
		super( MfMatchBean.class, "match_idx" );
	}
	
	@Override
	protected void clearOtherHash() {
		// TODO Auto-generated method stub
	}

	@Override
	protected void initKeyFields() throws Exception {
		// TODO Auto-generated method stub
	}

	@Override
	protected void putInOtherHash(Object data) throws Exception {
		// TODO Auto-generated method stub
	}
	
	public static SQLReturn getSql( String email ) {
        SQLReturn sret = new SQLReturn();
        
        sret.m_query = m_basequery + " AND m.src_user = '" + email + "'";
        sret.m_params = new ArrayList<Object>();
        sret.m_class = MatchingProfileBean.class;
        sret.m_colMap = null;
        
        return sret;
    }
	
	public static SQLReturn getSqlInsert( MfMatchBean _bean ) {
		SQLReturn ret = new SQLReturn();
		
		ret.m_query = m_insertQuery;
		ret.m_class = MfMatchBean.class;
		ret.m_colMap = null;
		ret.m_params = new ArrayList<Object>();
		ret.m_params.add(_bean.src_user);
		ret.m_params.add(_bean.dest_user);
		ret.m_params.add(_bean.score);
		ret.m_params.add(_bean.confirm);
		
		return ret;
	}
	
}
